/*
 * wraplinux.c
 */

#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>

void *
bpz_malloc(size_t size)
{
    void *ptr;

    if( (ptr = malloc(size)) == NULL ) {
        fprintf(stderr, "malloc error");
        exit(1);
    }
    return(ptr);
}

void *
bpz_calloc(size_t n, size_t size)
{
    void *ptr;

    if( (ptr = calloc(n, size)) == NULL ) {
        fprintf(stderr, "calloc error");
        exit(1);
    }
    return(ptr);
}

void *
bpz_realloc(void *ptr, size_t size)
{
    if( (ptr = realloc(ptr, size)) == NULL ) {
        fprintf(stderr, "realloc error");
        exit(1);
    }
    return(ptr);
}

int bpz_getchar()
{
	char ch;
	if( (ch = getchar()) == EOF ) {
		fprintf(stderr, "Could not read char\n");
		exit(1);
	}
	return ch;
}
